from common.Base import Base, open_op_browser

login_url = "http://localhost:8080/ecshop/user.php"
path = r"C:\Users\GrapeLier\AppData\Roaming\Mozilla\Firefox\Profiles\iybiyjzp.default-release"


class AutoLoginPage(Base):
    auto_login_loc = ('class name', 'f4_b')

    def auto_login(self):
        """
        自动登录 定位登录的用户名
        :return:
        """
        return self.get_element_text(self.auto_login_loc)


if __name__ == '__main__':
    driver = open_op_browser(path)
    ap = AutoLoginPage(driver)
    ap.open_url(login_url)
    print(ap.auto_login())
